<script setup>
import { ref, onMounted } from 'vue'

const isLoading = ref(false)
const checkLoading = () => {
  let timer = setInterval(() => {
    if (document.readyState === 'complete') {
      isLoading.value = false
      clearInterval(timer)
    }
  })
}
onMounted(() => {
  // checkLoading()
  const loadingEl = document.getElementById('app-loading')
  if (loadingEl) {
    loadingEl.remove()
  }
})
</script>

<template>
  <!-- 初始加载覆盖层 -->
  <div v-if="isLoading" class="loading-overlay">
    <!-- <myloading /> -->
  </div>

  <!-- 主内容区域 -->
  <RouterView v-slot="{ Component }">
    <transition name="fade" mode="out-in">
      <component :is="Component" />
    </transition>
  </RouterView>
</template>

<style lang="scss" scoped>
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>